package implementierung;

import schnittstellen.IValueElement;

public class ValueElement implements IValueElement
{

    private String name;

    private int value;

    public ValueElement(String name, int value)
    {
        super();
        this.name = name;
        this.value = value;
    }

    @Override
    public String getName()
    {
        return this.name;
    }

    @Override
    public void setName(String paramName)
    {
        if (paramName == null)
        {
            paramName = "null";
        }
        else
        {
            this.name = paramName;
        }
    }

    @Override
    public int getValue()
    {
        return this.value;
    }

    @Override
    public void setValue(int paramValue)
    {
        if (paramValue >= 0)
        {
            this.value = paramValue;
        }
        else
        {
            paramValue = 1;
        }
    }

    public String toString()
    {
        return ValueElement.this.name + Integer.toString(ValueElement.this.value);
    }

}
